]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspacesView: Make setGeometry take a rectangle
authorJasper St. Pierre <jstpierre@mecheye.net>
Mon, 25 Feb 2013 22:05:51 +0000 (17:05 -0500)
committerJasper St. Pierre <jstpierre@mecheye.net>
Sat, 20 Apr 2013 12:33:26 +0000 (08:33 -0400)
This cleanup will be more important in the future,
but for now, we can simply pass a monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=694469

js/ui/workspace.js
js/ui/workspacesView.js

index 145411b80942d63c8b67f3a477ea3569f630cc18..d3c380e7eaf496769ebc8183f69a6f18baa9861c 100644 (file)
@@ -956,15 +956,15 @@ const Workspace = new Lang.Class({
         this._positionWindowsId = 0;
     },
 
-    setGeometry: function(x, y, width, height) {
-        this._x = x;
-        this._y = y;
-        this._width = width;
-        this._height = height;
+    setGeometry: function(geom) {
+        this._x = geom.x;
+        this._y = geom.y;
+        this._width = geom.width;
+        this._height = geom.height;
 
         Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() {
-            this._dropRect.set_position(x, y);
-            this._dropRect.set_size(width, height);
+            this._dropRect.set_position(geom.x, geom.y);
+            this._dropRect.set_size(geom.width, geom.height);
             return false;
         }));
 
index 887b07ad30d7832db19d3b07825d2370358be6fe..9400d24abde519ec483dbef9f9aab1992fa2bac2 100644 (file)
@@ -124,10 +124,7 @@ const WorkspacesView = new Lang.Class({
                 continue;
 
             let ws = new Workspace.Workspace(null, i);
-            ws.setGeometry(monitors[i].x,
-                           monitors[i].y,
-                           monitors[i].width,
-                           monitors[i].height);
+            ws.setGeometry(monitors[i]);
             global.overlay_group.add_actor(ws.actor);
             this._extraWorkspaces.push(ws);
         }
@@ -139,18 +136,18 @@ const WorkspacesView = new Lang.Class({
         this._extraWorkspaces = [];
     },
 
-    setGeometry: function(x, y, width, height) {
-        if (this._x == x && this._y == y &&
-            this._width == width && this._height == height)
+    setGeometry: function(geom) {
+        if (this._x == geom.x && this._y == geom.y &&
+            this._width == geom.width && this._height == geom.height)
             return;
 
-        this._width = width;
-        this._height = height;
-        this._x = x;
-        this._y = y;
+        this._width = geom.width;
+        this._height = geom.height;
+        this._x = geom.x;
+        this._y = geom.y;
 
         for (let i = 0; i < this._workspaces.length; i++)
-            this._workspaces[i].setGeometry(x, y, width, height);
+            this._workspaces[i].setGeometry(geom);
     },
 
     _lookupWorkspaceForMetaWindow: function (metaWindow) {
@@ -281,8 +278,10 @@ const WorkspacesView = new Lang.Class({
 
         if (newNumWorkspaces > oldNumWorkspaces) {
             for (let w = oldNumWorkspaces; w < newNumWorkspaces; w++) {
-                this._workspaces[w].setGeometry(this._x, this._y,
-                                                this._width, this._height);
+                this._workspaces[w].setGeometry({ x: this._x,
+                                                  y: this._y,
+                                                  width: this._width,
+                                                  height: this._height });
                 this.actor.add_actor(this._workspaces[w].actor);
             }
 
@@ -645,13 +644,10 @@ const WorkspacesDisplay = new Lang.Class({
         let m = 0;
         for (let i = 0; i < monitors.length; i++) {
             if (i == this._primaryIndex) {
-                this._workspacesViews[m].setGeometry(x, y, width, height);
+                this._workspacesViews[m].setGeometry({ x: x, y: y, width: width, height: height });
                 m++;
             } else if (!this._workspacesOnlyOnPrimary) {
-                this._workspacesViews[m].setGeometry(monitors[i].x,
-                                                     monitors[i].y,
-                                                     monitors[i].width,
-                                                     monitors[i].height);
+                this._workspacesViews[m].setGeometry(monitors[i]);
                 m++;
             }
         }